package com.dyh.quickdemo.streamTest;

/*
@Author=Joey Wheeler
@Date=2021/3/12 18:24
*/
public interface MySink<T> extends MyConsumer<T>{
    default void accept(int value) {
        System.out.println("call accept(int value)");
        throw new IllegalStateException("called wrong accept int method");
    }



    default void accept(long value) {
        throw new IllegalStateException("called wrong accept long method");
    }

    interface OfInt extends MySink<Integer>,MyIntConsumer{

        @Override
        void accept(int value);//收束 覆盖了 MySink上的方法

        //        @Override
//        void accept(int value);
        @Override
        default void accept(Integer i) {
            accept(i.intValue());
        }
    }


    interface OfLong extends MySink<Long>,MyLongConsumer{

        @Override
        void accept(long value);//收束 覆盖了 MySink上的方法

        @Override
        default void accept(Long l) {
            accept(l.intValue());
        }
    }
}
